#pragma once

class CTimer
{
public:
	CTimer( );
	void Reset( ); // resets the timer
	void Start( ); // starts the timer
	void Stop( );  // stop (or pause) the timer
	double GetSystemTime( ); // get the absolute system time
	double GetTimeSinceStart( ); // get the current time
	double GetElapsedTimeByTimer(LONGLONG& LastTicks_io); // get the time that elapsed (seconds) between Get*Time( ) calls
	double GetElapsedTimeBySystem(LONGLONG& LastTicks_io);
	bool IsStopped( ); // returns true if timer stopped
	// Limit the current thread to one processor (the current one). _this ensures that timing code runs
	// on only one processor, and will not suffer any ill effects from power management.
	void LimitThreadAffinityToCurrentProc( );
protected:
	LONGLONG GetTicksSinceStart( );
	bool _TimeIsStopped;
	LONGLONG _TicksPerSec;
	LONGLONG _StopTicks;
	LONGLONG _StartTicks;

	int _Counter;
};